<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;

//前台首页控制器
class IndexController extends Controller{
    //首页
    public function index(){
    	//获取最新文章
    	$arcModel=new \Common\Model\Arc;
		$data=$arcModel
			->join('category','category_cid','=','cid')
			->where('is_recycle=0')
			->orderBy('sendtime','DESC')
			->get();
		//在data中添加标签
		$arcTagModel=new \Common\Model\ArcTag;
		foreach($data as $k=>$v){
			$data[$k]['tag']=$arcTagModel
							->join('tag','tag_tid','=','tid')
							->where("article_aid={$v['aid']}")
							->get();
		}
//		p($data);
		View::with('data',$data);
    	View::make();
    }
}
